using UnityEngine;
using System.Collections;

public class Item : WorldObject {
	public int itemIndex{get; set;}
	// Use this for initialization
	void Start () {
	//	Debug.Log(gameObject.name);
		ItemsCollectionMgr.Instance.RegisterItem(this);
		rayLength = Mathf.Max(transform.localScale.x , transform.localScale.y) + 0.05f;
		base.Start();
	}
	
	void Update () {
		if(IsMainCharacterPassing())
		{
			ItemsCollectionMgr.Instance.CollectItem(itemIndex);
		}
		
		
	}
	
	public void CollectThisItem()
	{
		
		//TODO: add animation and sound fx here
		Destroy(gameObject);
	}
}
